package com.test.www.utils.db.factory;

public class ComplexFactory {
    public static void main(String args[]){
        IFactory factory = new AddFactory();
        Operation operationAdd =  factory.CreateOption();
        operationAdd.setValue1(10);
        operationAdd.setValue2(5);
        System.out.println(operationAdd.getResule());
    }
}
//加法类工厂
 class AddFactory implements IFactory {

    public Operation CreateOption() {
        return new OperationAdd();
    }
}

//除法类工厂
 class DivFactory implements IFactory {

    public Operation CreateOption() {
        return new OperationDiv();
    }
}

//除法类工厂
 class MulFactory implements IFactory {

    public Operation CreateOption() {
        return new OperationMul();
    }
}

//减法类工厂
 class SubFactory implements IFactory {

    public Operation CreateOption() {
        return new OperationSub();
    }
}
